Optimal. Leaf size=262 \[ -\frac {i a^2 (c+d x)^2}{f}+\frac {a^2 (c+d x)^3}{3 d}-\frac {4 i a^2 (c+d x)^2 \text {ArcTan}\left (e^{i (e+f x)}\right )}{f}+\frac {2 a^2 d (c+d x) \log \left (1+e^{2 i (e+f x)}\right )}{f^2}+\frac {4 i a^2 d (c+d x) \text {PolyLog}\left (2,-i e^{i (e+f x)}\right )}{f^2}-\frac {4 i a^2 d (c+d x) \text {PolyLog}\left (2,i e^{i (e+f x)}\right )}{f^2}-\frac {i a^2 d^2 \text {PolyLog}\left (2,-e^{2 i (e+f x)}\right )}{f^3}-\frac {4 a^2 d^2 \text {PolyLog}\left (3,-i e^{i (e+f x)}\right )}{f^3}+\frac {4 a^2 d^2 \text {PolyLog}\left (3,i e^{i (e+f x)}\right )}{f^3}+\frac {a^2 (c+d x)^2 \tan (e+f x)}{f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.22, antiderivative size = 262, normalized size of antiderivative = 1.00, number of steps
used = 14, number of rules used = 10, integrand size = 20, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.500, Rules used = {4275, 4266,
2611, 2320, 6724, 4269, 3800, 2221, 2317, 2438} \begin {gather*} -\frac {4 i a^2 (c+d x)^2 \text {ArcTan}\left (e^{i (e+f x)}\right )}{f}+\frac {4 i a^2 d (c+d x) \text {Li}_2\left (-i e^{i (e+f x)}\right )}{f^2}-\frac {4 i a^2 d (c+d x) \text {Li}_2\left (i e^{i (e+f x)}\right )}{f^2}+\frac {2 a^2 d (c+d x) \log \left (1+e^{2 i (e+f x)}\right )}{f^2}+\frac {a^2 (c+d x)^2 \tan (e+f x)}{f}-\frac {i a^2 (c+d x)^2}{f}+\frac {a^2 (c+d x)^3}{3 d}-\frac {i a^2 d^2 \text {Li}_2\left (-e^{2 i (e+f x)}\right )}{f^3}-\frac {4 a^2 d^2 \text {Li}_3\left (-i e^{i (e+f x)}\right )}{f^3}+\frac {4 a^2 d^2 \text {Li}_3\left (i e^{i (e+f x)}\right )}{f^3} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 2221
Rule 2317
Rule 2320
Rule 2438
Rule 2611
Rule 3800
Rule 4266
Rule 4269
Rule 4275
Rule 6724
Rubi steps
\begin {align*} \int (c+d x)^2 (a+a \sec (e+f x))^2 \, dx &=\int \left (a^2 (c+d x)^2+2 a^2 (c+d x)^2 \sec (e+f x)+a^2 (c+d x)^2 \sec ^2(e+f x)\right ) \, dx\\ &=\frac {a^2 (c+d x)^3}{3 d}+a^2 \int (c+d x)^2 \sec ^2(e+f x) \, dx+\left (2 a^2\right ) \int (c+d x)^2 \sec (e+f x) \, dx\\ &=\frac {a^2 (c+d x)^3}{3 d}-\frac {4 i a^2 (c+d x)^2 \tan ^{-1}\left (e^{i (e+f x)}\right )}{f}+\frac {a^2 (c+d x)^2 \tan (e+f x)}{f}-\frac {\left (2 a^2 d\right ) \int (c+d x) \tan (e+f x) \, dx}{f}-\frac {\left (4 a^2 d\right ) \int (c+d x) \log \left (1-i e^{i (e+f x)}\right ) \, dx}{f}+\frac {\left (4 a^2 d\right ) \int (c+d x) \log \left (1+i e^{i (e+f x)}\right ) \, dx}{f}\\ &=-\frac {i a^2 (c+d x)^2}{f}+\frac {a^2 (c+d x)^3}{3 d}-\frac {4 i a^2 (c+d x)^2 \tan ^{-1}\left (e^{i (e+f x)}\right )}{f}+\frac {4 i a^2 d (c+d x) \text {Li}_2\left (-i e^{i (e+f x)}\right )}{f^2}-\frac {4 i a^2 d (c+d x) \text {Li}_2\left (i e^{i (e+f x)}\right )}{f^2}+\frac {a^2 (c+d x)^2 \tan (e+f x)}{f}-\frac {\left (4 i a^2 d^2\right ) \int \text {Li}_2\left (-i e^{i (e+f x)}\right ) \, dx}{f^2}+\frac {\left (4 i a^2 d^2\right ) \int \text {Li}_2\left (i e^{i (e+f x)}\right ) \, dx}{f^2}+\frac {\left (4 i a^2 d\right ) \int \frac {e^{2 i (e+f x)} (c+d x)}{1+e^{2 i (e+f x)}} \, dx}{f}\\ &=-\frac {i a^2 (c+d x)^2}{f}+\frac {a^2 (c+d x)^3}{3 d}-\frac {4 i a^2 (c+d x)^2 \tan ^{-1}\left (e^{i (e+f x)}\right )}{f}+\frac {2 a^2 d (c+d x) \log \left (1+e^{2 i (e+f x)}\right )}{f^2}+\frac {4 i a^2 d (c+d x) \text {Li}_2\left (-i e^{i (e+f x)}\right )}{f^2}-\frac {4 i a^2 d (c+d x) \text {Li}_2\left (i e^{i (e+f x)}\right )}{f^2}+\frac {a^2 (c+d x)^2 \tan (e+f x)}{f}-\frac {\left (4 a^2 d^2\right ) \text {Subst}\left (\int \frac {\text {Li}_2(-i x)}{x} \, dx,x,e^{i (e+f x)}\right )}{f^3}+\frac {\left (4 a^2 d^2\right ) \text {Subst}\left (\int \frac {\text {Li}_2(i x)}{x} \, dx,x,e^{i (e+f x)}\right )}{f^3}-\frac {\left (2 a^2 d^2\right ) \int \log \left (1+e^{2 i (e+f x)}\right ) \, dx}{f^2}\\ &=-\frac {i a^2 (c+d x)^2}{f}+\frac {a^2 (c+d x)^3}{3 d}-\frac {4 i a^2 (c+d x)^2 \tan ^{-1}\left (e^{i (e+f x)}\right )}{f}+\frac {2 a^2 d (c+d x) \log \left (1+e^{2 i (e+f x)}\right )}{f^2}+\frac {4 i a^2 d (c+d x) \text {Li}_2\left (-i e^{i (e+f x)}\right )}{f^2}-\frac {4 i a^2 d (c+d x) \text {Li}_2\left (i e^{i (e+f x)}\right )}{f^2}-\frac {4 a^2 d^2 \text {Li}_3\left (-i e^{i (e+f x)}\right )}{f^3}+\frac {4 a^2 d^2 \text {Li}_3\left (i e^{i (e+f x)}\right )}{f^3}+\frac {a^2 (c+d x)^2 \tan (e+f x)}{f}+\frac {\left (i a^2 d^2\right ) \text {Subst}\left (\int \frac {\log (1+x)}{x} \, dx,x,e^{2 i (e+f x)}\right )}{f^3}\\ &=-\frac {i a^2 (c+d x)^2}{f}+\frac {a^2 (c+d x)^3}{3 d}-\frac {4 i a^2 (c+d x)^2 \tan ^{-1}\left (e^{i (e+f x)}\right )}{f}+\frac {2 a^2 d (c+d x) \log \left (1+e^{2 i (e+f x)}\right )}{f^2}+\frac {4 i a^2 d (c+d x) \text {Li}_2\left (-i e^{i (e+f x)}\right )}{f^2}-\frac {4 i a^2 d (c+d x) \text {Li}_2\left (i e^{i (e+f x)}\right )}{f^2}-\frac {i a^2 d^2 \text {Li}_2\left (-e^{2 i (e+f x)}\right )}{f^3}-\frac {4 a^2 d^2 \text {Li}_3\left (-i e^{i (e+f x)}\right )}{f^3}+\frac {4 a^2 d^2 \text {Li}_3\left (i e^{i (e+f x)}\right )}{f^3}+\frac {a^2 (c+d x)^2 \tan (e+f x)}{f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 5.71, size = 505, normalized size = 1.93 \begin {gather*} \frac {1}{12} a^2 (1+\cos (e+f x))^2 \sec ^4\left (\frac {1}{2} (e+f x)\right ) \left (x \left (3 c^2+3 c d x+d^2 x^2\right )+\frac {3 (c+d x)^2 \sin \left (\frac {f x}{2}\right )}{f \left (\cos \left (\frac {e}{2}\right )-\sin \left (\frac {e}{2}\right )\right ) \left (\cos \left (\frac {1}{2} (e+f x)\right )-\sin \left (\frac {1}{2} (e+f x)\right )\right )}+\frac {3 (c+d x)^2 \sin \left (\frac {f x}{2}\right )}{f \left (\cos \left (\frac {e}{2}\right )+\sin \left (\frac {e}{2}\right )\right ) \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )}-\frac {3 i \left (2 c d f^2 x+d^2 f^2 x^2+4 c^2 f^2 \text {ArcTan}(\cos (e+f x)+i \sin (e+f x))+8 c d f^2 x \text {ArcTan}(\cos (e+f x)+i \sin (e+f x))+4 d^2 f^2 x^2 \text {ArcTan}(\cos (e+f x)+i \sin (e+f x))+2 i c d f \log (1+\cos (2 (e+f x))+i \sin (2 (e+f x)))+2 i d^2 f x \log (1+\cos (2 (e+f x))+i \sin (2 (e+f x)))+4 d f (c+d x) \text {PolyLog}(2,i \cos (e+f x)-\sin (e+f x))-4 d f (c+d x) \text {PolyLog}(2,-i \cos (e+f x)+\sin (e+f x))+d^2 \text {PolyLog}(2,-\cos (2 (e+f x))-i \sin (2 (e+f x)))+4 i d^2 \text {PolyLog}(3,i \cos (e+f x)-\sin (e+f x))-4 i d^2 \text {PolyLog}(3,-i \cos (e+f x)+\sin (e+f x))+2 i c d f^2 x \tan (e)+i d^2 f^2 x^2 \tan (e)\right )}{f^3}\right ) \end {gather*}
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
Maple [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 678 vs. \(2 (237 ) = 474\).
time = 0.87, size = 679, normalized size = 2.59
method | result | size |
risch | \(\frac {8 i a^{2} c d e \arctan \left ({\mathrm e}^{i \left (f x +e \right )}\right )}{f^{2}}+\frac {4 i a^{2} d^{2} \polylog \left (2, -i {\mathrm e}^{i \left (f x +e \right )}\right ) x}{f^{2}}-\frac {2 a^{2} d^{2} \ln \left (1+i {\mathrm e}^{i \left (f x +e \right )}\right ) x^{2}}{f}+\frac {2 a^{2} d^{2} \ln \left (1-i {\mathrm e}^{i \left (f x +e \right )}\right ) x^{2}}{f}+\frac {2 a^{2} e^{2} d^{2} \ln \left (1+i {\mathrm e}^{i \left (f x +e \right )}\right )}{f^{3}}-\frac {2 i a^{2} d^{2} x^{2}}{f}-\frac {2 i a^{2} e^{2} d^{2}}{f^{3}}-\frac {4 i a^{2} c^{2} \arctan \left ({\mathrm e}^{i \left (f x +e \right )}\right )}{f}+\frac {4 a^{2} d^{2} e \ln \left ({\mathrm e}^{i \left (f x +e \right )}\right )}{f^{3}}+\frac {2 a^{2} d^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) x}{f^{2}}-\frac {2 a^{2} e^{2} d^{2} \ln \left (1-i {\mathrm e}^{i \left (f x +e \right )}\right )}{f^{3}}-\frac {i a^{2} d^{2} \polylog \left (2, -{\mathrm e}^{2 i \left (f x +e \right )}\right )}{f^{3}}+\frac {4 a^{2} d^{2} \polylog \left (3, i {\mathrm e}^{i \left (f x +e \right )}\right )}{f^{3}}-\frac {4 i a^{2} d^{2} \polylog \left (2, i {\mathrm e}^{i \left (f x +e \right )}\right ) x}{f^{2}}-\frac {4 i a^{2} c d \polylog \left (2, i {\mathrm e}^{i \left (f x +e \right )}\right )}{f^{2}}+\frac {4 i a^{2} c d \polylog \left (2, -i {\mathrm e}^{i \left (f x +e \right )}\right )}{f^{2}}-\frac {4 a^{2} c d \ln \left (1+i {\mathrm e}^{i \left (f x +e \right )}\right ) e}{f^{2}}-\frac {4 a^{2} c d \ln \left (1+i {\mathrm e}^{i \left (f x +e \right )}\right ) x}{f}+\frac {4 a^{2} c d \ln \left (1-i {\mathrm e}^{i \left (f x +e \right )}\right ) x}{f}+\frac {4 a^{2} c d \ln \left (1-i {\mathrm e}^{i \left (f x +e \right )}\right ) e}{f^{2}}-\frac {4 i a^{2} d^{2} e x}{f^{2}}-\frac {4 i a^{2} d^{2} e^{2} \arctan \left ({\mathrm e}^{i \left (f x +e \right )}\right )}{f^{3}}+\frac {a^{2} d^{2} x^{3}}{3}+\frac {2 i a^{2} \left (d^{2} x^{2}+2 c d x +c^{2}\right )}{f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}+\frac {2 a^{2} c d \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}{f^{2}}-\frac {4 a^{2} c d \ln \left ({\mathrm e}^{i \left (f x +e \right )}\right )}{f^{2}}+\frac {a^{2} c^{3}}{3 d}+a^{2} d c \,x^{2}+a^{2} c^{2} x -\frac {4 a^{2} d^{2} \polylog \left (3, -i {\mathrm e}^{i \left (f x +e \right )}\right )}{f^{3}}\) | \(679\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Both result and optimal contain complex but leaf count of result is larger than
twice the leaf count of optimal. 1829 vs. \(2 (233) = 466\).
time = 0.69, size = 1829, normalized size = 6.98 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 1151 vs. \(2 (233) = 466\).
time = 3.41, size = 1151, normalized size = 4.39 \begin {gather*} -\frac {6 \, a^{2} d^{2} \cos \left (f x + e\right ) {\rm polylog}\left (3, i \, \cos \left (f x + e\right ) + \sin \left (f x + e\right )\right ) - 6 \, a^{2} d^{2} \cos \left (f x + e\right ) {\rm polylog}\left (3, i \, \cos \left (f x + e\right ) - \sin \left (f x + e\right )\right ) + 6 \, a^{2} d^{2} \cos \left (f x + e\right ) {\rm polylog}\left (3, -i \, \cos \left (f x + e\right ) + \sin \left (f x + e\right )\right ) - 6 \, a^{2} d^{2} \cos \left (f x + e\right ) {\rm polylog}\left (3, -i \, \cos \left (f x + e\right ) - \sin \left (f x + e\right )\right ) + 3 \, {\left (2 i \, a^{2} d^{2} f x + 2 i \, a^{2} c d f - i \, a^{2} d^{2}\right )} \cos \left (f x + e\right ) {\rm Li}_2\left (i \, \cos \left (f x + e\right ) + \sin \left (f x + e\right )\right ) + 3 \, {\left (2 i \, a^{2} d^{2} f x + 2 i \, a^{2} c d f + i \, a^{2} d^{2}\right )} \cos \left (f x + e\right ) {\rm Li}_2\left (i \, \cos \left (f x + e\right ) - \sin \left (f x + e\right )\right ) + 3 \, {\left (-2 i \, a^{2} d^{2} f x - 2 i \, a^{2} c d f + i \, a^{2} d^{2}\right )} \cos \left (f x + e\right ) {\rm Li}_2\left (-i \, \cos \left (f x + e\right ) + \sin \left (f x + e\right )\right ) + 3 \, {\left (-2 i \, a^{2} d^{2} f x - 2 i \, a^{2} c d f - i \, a^{2} d^{2}\right )} \cos \left (f x + e\right ) {\rm Li}_2\left (-i \, \cos \left (f x + e\right ) - \sin \left (f x + e\right )\right ) - 3 \, {\left (a^{2} c^{2} f^{2} + a^{2} c d f + a^{2} d^{2} e^{2} - {\left (2 \, a^{2} c d f + a^{2} d^{2}\right )} e\right )} \cos \left (f x + e\right ) \log \left (\cos \left (f x + e\right ) + i \, \sin \left (f x + e\right ) + i\right ) + 3 \, {\left (a^{2} c^{2} f^{2} - a^{2} c d f + a^{2} d^{2} e^{2} - {\left (2 \, a^{2} c d f - a^{2} d^{2}\right )} e\right )} \cos \left (f x + e\right ) \log \left (\cos \left (f x + e\right ) - i \, \sin \left (f x + e\right ) + i\right ) - 3 \, {\left (a^{2} d^{2} f^{2} x^{2} - a^{2} d^{2} e^{2} + {\left (2 \, a^{2} c d f^{2} + a^{2} d^{2} f\right )} x + {\left (2 \, a^{2} c d f + a^{2} d^{2}\right )} e\right )} \cos \left (f x + e\right ) \log \left (i \, \cos \left (f x + e\right ) + \sin \left (f x + e\right ) + 1\right ) + 3 \, {\left (a^{2} d^{2} f^{2} x^{2} - a^{2} d^{2} e^{2} + {\left (2 \, a^{2} c d f^{2} - a^{2} d^{2} f\right )} x + {\left (2 \, a^{2} c d f - a^{2} d^{2}\right )} e\right )} \cos \left (f x + e\right ) \log \left (i \, \cos \left (f x + e\right ) - \sin \left (f x + e\right ) + 1\right ) - 3 \, {\left (a^{2} d^{2} f^{2} x^{2} - a^{2} d^{2} e^{2} + {\left (2 \, a^{2} c d f^{2} + a^{2} d^{2} f\right )} x + {\left (2 \, a^{2} c d f + a^{2} d^{2}\right )} e\right )} \cos \left (f x + e\right ) \log \left (-i \, \cos \left (f x + e\right ) + \sin \left (f x + e\right ) + 1\right ) + 3 \, {\left (a^{2} d^{2} f^{2} x^{2} - a^{2} d^{2} e^{2} + {\left (2 \, a^{2} c d f^{2} - a^{2} d^{2} f\right )} x + {\left (2 \, a^{2} c d f - a^{2} d^{2}\right )} e\right )} \cos \left (f x + e\right ) \log \left (-i \, \cos \left (f x + e\right ) - \sin \left (f x + e\right ) + 1\right ) - 3 \, {\left (a^{2} c^{2} f^{2} + a^{2} c d f + a^{2} d^{2} e^{2} - {\left (2 \, a^{2} c d f + a^{2} d^{2}\right )} e\right )} \cos \left (f x + e\right ) \log \left (-\cos \left (f x + e\right ) + i \, \sin \left (f x + e\right ) + i\right ) + 3 \, {\left (a^{2} c^{2} f^{2} - a^{2} c d f + a^{2} d^{2} e^{2} - {\left (2 \, a^{2} c d f - a^{2} d^{2}\right )} e\right )} \cos \left (f x + e\right ) \log \left (-\cos \left (f x + e\right ) - i \, \sin \left (f x + e\right ) + i\right ) - {\left (a^{2} d^{2} f^{3} x^{3} + 3 \, a^{2} c d f^{3} x^{2} + 3 \, a^{2} c^{2} f^{3} x\right )} \cos \left (f x + e\right ) - 3 \, {\left (a^{2} d^{2} f^{2} x^{2} + 2 \, a^{2} c d f^{2} x + a^{2} c^{2} f^{2}\right )} \sin \left (f x + e\right )}{3 \, f^{3} \cos \left (f x + e\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} a^{2} \left (\int c^{2}\, dx + \int 2 c^{2} \sec {\left (e + f x \right )}\, dx + \int c^{2} \sec ^{2}{\left (e + f x \right )}\, dx + \int d^{2} x^{2}\, dx + \int 2 c d x\, dx + \int 2 d^{2} x^{2} \sec {\left (e + f x \right )}\, dx + \int d^{2} x^{2} \sec ^{2}{\left (e + f x \right )}\, dx + \int 4 c d x \sec {\left (e + f x \right )}\, dx + \int 2 c d x \sec ^{2}{\left (e + f x \right )}\, dx\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.00 \begin {gather*} \int {\left (a+\frac {a}{\cos \left (e+f\,x\right )}\right )}^2\,{\left (c+d\,x\right )}^2 \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________